package bancosys.tec.rtm.exception;

import java.io.IOException;

/**
 * Backup caso a persistencia principal falhe
 * 
 * @author Koji
 */
public interface BackupExceptionPersister {

    /**
     * @param exception {@link Throwable}
     * @throws IOException se houver uma IOException
     */
    void store(Throwable exception) throws IOException;

    /**
     * Carrega todos os dados da persistencia backup e os salva na persistencia principal.
     * 
     * @param exceptionPersister {@link ExceptionPersister}
     * @throws IOException e
     * @throws ClassNotFoundException e
     * @throws RTMException e
     */
    void loadAndSaveBackupInExceptionPersister(ExceptionPersister exceptionPersister) throws IOException, ClassNotFoundException,
            RTMException;

    /**
     * Retorna o tamanho do arquivo.
     * 
     * @return long
     */
    long getSize();

    /**
     * @return boolean
     */
    boolean isEmpty();

    /**
     * Apaga os dados
     * 
     * @throws IOException e
     */
    void clearBackup() throws IOException;
}
